<template>
  <div class="BOM-page">
    <!-- 页面标题 -->
    <div class="title">
      <h4>BOM设置</h4>
    </div>
    <!-- 表单 -->
    <div class="form">
      <el-form label-width="110px" ref="form" :model="messageData">
        <el-form-item label="是否包含压缩">
          <el-switch v-model="messageData.IsIncludeSuppressed"></el-switch>
        </el-form-item>
        <el-form-item label="是否读取不包含在材料明细表">
          <el-switch v-model="messageData.IsExcludeFromBOM"></el-switch>
        </el-form-item>
        <el-form-item label="是否包含封套">
          <el-switch v-model="messageData.IsIncludeEnvelope"></el-switch>
        </el-form-item>
        <el-form-item label="是否包含隐藏">
          <el-switch v-model="messageData.IsIncludeHidden"></el-switch>
        </el-form-item>
        <el-form-item label="是否包含虚拟">
          <el-switch v-model="messageData.IsIncludeVirtual"></el-switch>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="onSubmit">保存</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import { GetBOMSettingApi, SaveAndChangeBOMSettingApi } from "@/api/BOM";
export default {
  data() {
    return {
      checkList: [],
      messageData: {
        IsIncludeSuppressed: false,
        IsExcludeFromBOM: false,
        IsIncludeEnvelope: false,
        IsIncludeHidden: false,
        IsIncludeVirtual: false,
      },
    };
  },
  created() {
    this.GetBOMSetting();
  },
  methods: {
    async GetBOMSetting() {
      const res = await GetBOMSettingApi();
      console.log(res.data);
      this.messageData = res.data;
    },
    async onSubmit() {
      const res = await SaveAndChangeBOMSettingApi(this.messageData);
      console.log(res);
    },
  },
};
</script>

<style lang="scss" scoped>
.BOM-page {
  background-color: #fff;
  padding: 30px 50px;

  .title h4 {
    font-size: 22px;
    font-weight: 600;
  }

  .form {
    padding-left: 100px;
  }
}
</style>